"""
@author: Sergiy Tsymbalyuk
"""

import logging

from pylons.i18n import lazy_ugettext as _
from repoze.what.plugins.pylonshq import ControllerProtector

from chowa.lib.site.crud import FlatCrudController
from hrms.lib.predicates import profile
from hrms.model.person import EmploymentHistory

log = logging.getLogger(__name__)

@ControllerProtector(profile())
class HistoryController(FlatCrudController):
    __model__ = EmploymentHistory
    __columns__ = ['employee', 'description', 'started', 'ended',
                   'is_financial', 'is_state', 'is_treasury']
    __edit_columns__ = ['employee', 'description', 'started', 'ended',
                        'is_financial', 'is_state', 'is_treasury']
    __bool_values__ = {'is_financial': (_('Yes'), '', ''),
                       'is_state': (_('Yes'), '', ''),
                       'is_treasury': (_('Yes'), '', '')}
    __index_header__ = {'is_financial': _('Abbr|Is financial'),
                        'is_state': _('Abbr|Is state'),
                        'is_treasury': _('Abbr|Is treasury')}
